package com.dt76.smallloanbackenduser.controller.lhuaw;

import com.dt76.smallloanbackenduser.remote.lhuaw.Applicationtest;
import com.dt76.smallloanbackenduser.utils.Page;
import com.dt76.smallloanbackenduser.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/lhuaw")
public class AppcationController {
    @Autowired
    private Applicationtest applicationtest;

@RequestMapping("/qryAllApplication")
public String qryAllApplication(Model model){
    model.addAttribute("ApplicationList",applicationtest.qryAllApplication());
    System.out.println("调用成功");
    System.out.println(applicationtest.qryAllApplication());
    return "pages/lhuaw/Application";
}
@RequestMapping("/getApplicationAll")
public String getApplicationAll(Model model, Integer currentPageNo){
   if (currentPageNo <= 0) {
        currentPageNo = 1;
   }
    Page page = applicationtest.getApplicationAll(currentPageNo);
    model.addAttribute("qryApplicationList",page.getRows());
    model.addAttribute("page",page);
    System.out.println(page.getRows());
    return "pages/lhuaw/Application";
}
    @RequestMapping("/deleteStation/{numId}")
    @ResponseBody
    public Result delete(@PathVariable String numId){
        return applicationtest.deleteStation(Integer.parseInt(numId));
    }

}
